package com.aabte.springbootopenfeigndemo.core.exception;

import lombok.Getter;

@Getter
public abstract class ApplicationException extends RuntimeException {

    private String code = "sys.error";

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(Throwable cause) {
        super(cause);
    }

    public ApplicationException(String code, String message) {
        super(message);
        this.code = code;
    }

    public ApplicationException(String code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }


    @Override
    public String getMessage() {
        return "code: " + this.code + ", msg: " + super.getMessage();
    }

    public String getMessageWithoutCode() {
        return super.getMessage();
    }
}
